import { API } from '../config/config';

import HTTP from '../utils/http';

const TEACHER = API.TEACHER;

class TeacherService extends HTTP {
  
  async getTeacherData() {
    return new Promise((resolve, reject) => {
      this.axiosGet({
        url: TEACHER.GET_TEACHERS,
        success: (res) => {
          resolve(res);
        },
        error: (err) => {
          alert('网络请求错误');
          window.location.reload();
        }
      })
    })
  }

  async selectStarTeacher(data) {
    return new Promise((resolve, reject) => {
      this.axiosPost({
        url: TEACHER.SELECT_STAR_TEACHER,
        data: data,
        success(res){
          resolve(res);
        },
        error(error){
          alert('网络请求错误');
          window.location.reload();
        }
      })
    })
  }
 
}

export default TeacherService;